import {Column, Entity, Index, PrimaryGeneratedColumn} from "typeorm";

@Index("idx_su_del_flag", ["delFlag"], {})
@Index("idx_su_status", ["status"], {})
@Index("idx_su_username", ["username"], {})
@Index("uniq_sys_user_email", ["email"], { unique: true })
@Index("uniq_sys_user_phone", ["phone"], { unique: true })
@Index("uniq_sys_user_username", ["username"], { unique: true })
@Index("uniq_sys_user_work_no", ["workNo"], { unique: true })
@Entity("sys_user", { schema: "workflow" })
export class CreateSysUserDto {
    @Column("char", { primary: true, name: "id", comment: "主键id", length: 36 })
    @PrimaryGeneratedColumn("uuid")
    id: string;

    @Column("varchar", {
        name: "username",
        nullable: true,
        unique: true,
        comment: "登录账号",
        length: 100,
    })
    username: string | null;

    @Column("varchar", {
        name: "realname",
        nullable: true,
        comment: "真实姓名",
        length: 100,
    })
    realname: string | null;

    @Column("varchar", {
        name: "password",
        nullable: true,
        comment: "密码",
        length: 255,
    })
    password: string | null;

    @Column("varchar", {
        name: "salt",
        nullable: true,
        comment: "md5密码盐",
        length: 45,
    })
    salt: string | null;

    @Column("varchar", {
        name: "avatar",
        nullable: true,
        comment: "头像",
        length: 255,
    })
    avatar: string | null;

    @Column("varchar", {
        name: "signature",
        nullable: true,
        comment: " 个性签名",
        length: 255,
    })
    signature: string | null;

    @Column("datetime", { name: "birthday", nullable: true, comment: "生日" })
    birthday: Date | null;

    @Column("tinyint", {
        name: "sex",
        nullable: true,
        comment: "性别(0默认未知,1男,2女)",
        width: 1,
        default: () => "'0'",
    })
    sex: boolean | null;

    @Column("varchar", {
        name: "email",
        nullable: true,
        unique: true,
        comment: "电子邮件",
        length: 45,
    })
    email: string | null;

    @Column("varchar", {
        name: "phone",
        nullable: true,
        unique: true,
        comment: "电话",
        length: 20,
    })
    phone: string | null;

    @Column("varchar", {
        name: "address",
        nullable: true,
        comment: "地址",
        length: 100,
    })
    address: string | null;

    @Column("tinyint", {
        name: "status",
        nullable: true,
        comment: "性别(1正常,2冻结)",
        width: 1,
        default: () => "'0'",
    })
    status: boolean | null;

    @Column("tinyint", {
        name: "del_flag",
        nullable: true,
        comment: "删除状态(0正常,1已删除)",
        width: 1,
        default: () => "'0'",
    })
    delFlag: boolean | null;

    @Column("tinyint", {
        name: "activity_sync",
        nullable: true,
        comment: "同步工作流(1同步,0不同步)",
        width: 1,
        default: () => "'1'",
    })
    activitySync: boolean | null;

    @Column("varchar", {
        name: "work_no",
        nullable: true,
        unique: true,
        comment: "工号，唯一键",
        length: 100,
    })
    workNo: string | null;

    @Column("varchar", {
        name: "title",
        nullable: true,
        comment: "职务",
        length: 100,
    })
    title: string | null;

    @Column("varchar", {
        name: "telephone",
        nullable: true,
        comment: "座机号",
        length: 20,
    })
    telephone: string | null;

    @Column("char", {
        name: "create_by",
        nullable: true,
        comment: "创建人",
        length: 36,
    })
    createBy: string | null;

    @Column("datetime", {
        name: "create_time",
        nullable: true,
        comment: "创建时间",
    })
    createTime: Date | null;

    @Column("char", {
        name: "update_by",
        nullable: true,
        comment: "更新人",
        length: 36,
    })
    updateBy: string | null;

    @Column("datetime", {
        name: "update_time",
        nullable: true,
        comment: "更新时间",
    })
    updateTime: Date | null;
}
